package first.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *    url-pattern
 *  （1）精确匹配  /xxx
 *  （2）后缀匹配  *.do   *.action
 *  (3) 通配符匹配   /* 			    匹配所有请求，包含服务器的所有资源
 *  (4) 通配符匹配   /                匹配所有请求，包含服务器的所有资源，不包括.jsp
 */
@WebServlet(name = "MyServlet2", urlPatterns = "*.do")
public class MyServlet2 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("MyServlet2执行了");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
